<template>
  <div class="message">
    <div class="all">
      <input
        placeholder="请输入搜索内容"
        type="text"
        v-model="keyWord"
        @keydown.enter="search(this.keyWord)"
      />
      <svg class="icon" aria-hidden="true" @click="search(this.keyWord)">
        <use xlink:href="#icon-search"></use>
      </svg>
    </div>
  </div>
</template>

<script>
import { getSearch } from "../api/api.js";

export default {
  data() {
    return {
      keyWord: "",
    };
  },
  methods: {
    search: function (word) {
      if (word != "") {
        this.$router.push({ name: "SearchList", params: { key: word } });
      }
    },
  },
  mounted: async function () {},
};
</script>

<style lang="less">
.message {
  min-width: 7.5rem;
  min-height: 100vh;
  background-color: #f5f6fa;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  input {
    width: 5rem;
    height: 1rem;
    border: none;
    background-color: #f5f6fa;
    outline: none;
    border: solid 0.04rem #273c75;
    border-radius: 0.5rem;
    padding-left: 0.4rem;
    padding-right: 1rem;
    overflow: hidden;
    font-size: 0.4rem;
    margin-bottom: 1rem;
    // position: absolute;
    // top: 4rem;
    color: #273c75;
  }
  input::-webkit-input-placeholder {
    color: #7f8fa6;
  }
  .all{
    position: relative;
  }
  .icon {
    width: 0.4rem;
    height: 0.4rem;
    fill: #273c75;
    position: absolute;
    right: 0.35rem;
    top: 0.3rem;
  }
}
</style>